﻿
using Newtonsoft.Json;

namespace Ma.Bussiness.MaperExtend;

/// <summary>
/// 使用第三方序列化反序列化工具
/// 还有automapper
/// </summary>
public class SerializeMapper
{
    /// <summary>
    /// 利用序列化反序列化 进行实体转换
    /// </summary>
    /// <typeparam name="Tin"></typeparam>
    /// <typeparam name="Tout"></typeparam>
    /// <param name="tin"></param>
    /// <returns></returns>
    public static Tout Maper<Tin, Tout>(Tin tin)
    {
        return JsonConvert.DeserializeObject<Tout>(JsonConvert.SerializeObject(tin));
    }
}
